﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CluelessGame
{
    [Serializable]
    public class Player : INotifyPropertyChanged
    {
        private Character _associatedCharacter = null;
        public Character AssociatedCharacter
        {
            get { return _associatedCharacter; }
            set
            {
                _associatedCharacter = value;
                if (_associatedCharacter != null)
                {
                    _associatedCharacter.AssociatedPlayer = this;
                }
            }
        }

        private string _name = "unkown";
        public string Name
        {
            get { return _name; }
            set { _name = value; NotifyPropertyChanged("Name"); }
        }
        public int ID = -1;
        public List<Card> Hand = null;
        public bool InGame = false;
        public bool Lost = false;


        #region INotifyPropertyChanged Members

        [field: NonSerialized]
        public event PropertyChangedEventHandler PropertyChanged;

        private void NotifyPropertyChanged(String info)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(info));
            }
        }

        public override string ToString()
        {
            return Name;
        }

        #endregion

    }
}
